home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
pd
/
serien
/
purity
/
nr.43
/
flushcx
/
source
/
flushcx.p
< prev
next >
Wrap
Text File
|
1995-01-07
|
4KB
|
131 lines
{ FlushCX. © by J.Stötzer. All rights reserved, look into docu for more info }
program FlushCX;
uese Exec,ExecSupport,Intuition;
{$incl 'dos.lib','workbench/startup.h','wb.lib','commodities.lib'}
const LF = chr(10);
type stringTyp = string[500];
VAR CPort : p_MsgPort;
CItem : p_AppMenuItem;
CMsg : p_AppMessage;
CCl : word;
WBTask : p_Task;
ret : long;
ex,err : boolean;
{************************************************************************}
procedure Terminate; { Macht allen Commodities das Licht aus }
type p_BrokerCopy = ^BrokerCopy;
BrokerCopy = record
bc_Node : Node;
bc_Name : string[CBD_NAMELEN];
bc_Title: string[CBD_TITLELEN];
bc_Descr: string[CBD_DESCRLEN];
bc_Task,bc_blabla,bc_blubber : long;
bc_Flags: word;
end;
var BList : p_List;
CNode : p_Node;
HNode : p_BrokerCopy;
ok : long;
begin
CXBase:=OpenLibrary("commodities.library",37);
if CXBase<>Nil then begin
BList:=ptr(AllocVec(SizeOf(List),MEMF_PUBLIC));
if BList<>Nil then begin
NewList(BList);
ok:=CopyBrokerList(BList);
CNode:=BList^.lh_Head;
repeat
HNode:=p_BrokerCopy(ptr(CNode));
BrokerCommand(HNode^.bc_Name,CXCMD_KILL);
CNode:=CNode^.ln_Succ;
until CNode=Nil;
ok:=FreeBrokerList(BList);
FreeVec(BList);
end;
CloseLibrary(CXBase);
end;
end;
{************************************************************************}
function Req(bt:stringTyp;gt:str):long;
var ret : long;
es : EasyStruct;
begin
es:=EasyStruct(SizeOf(EasyStruct),0,"FlushCX © by Janosh/NEOPLASIA",bt,gt);
ret:=EasyRequestArgs(Nil,^es,Nil,Nil);
Req:=ret;
end;
{************************************************************************}
begin
WBTask:=FindTask('Workbench');
if WBTask<>Nil then begin
WorkBenchBase:=OpenLibrary('workbench.library',37);
if WorkbenchBase<>Nil then begin
CPort:=CreateMsgPort;
if CPort<>Nil then begin
CItem:=AddAppMenuItemA(0,0,'FlushCX',CPort,Nil);
if CItem<>Nil then begin
ex:=false;
repeat
CMsg:=ptr(WaitPort(CPort));
CMsg:=ptr(GetMsg(CPort));
CCl:=CMsg^.am_Type;
ReplyMsg(ptr(CMsg));
if CCl=MTYPE_APPMENUITEM then begin
ret:=Req("Really kill all commodities ??",
"Yep!|About|Exit FlushCX|No");
case ret of
1 : Terminate;
2 : ret:=Req("FlushCX Version 1.00"+LF+"~~~~~~~~~~~~~~~~~~~~"+LF+LF+
"© 12/1994 by Janosh / NEOPLASIA"+LF+LF+
"It`s Freeware, look into the"+LF+
"documentation for more info."+LF+LF+
"To contact me try:"+LF+
" J. Stötzer"+LF+" An der Hasel 195"+LF+
" D-98527 Suhl / GERMANY"+LF+LF+
"E-Mail: stoetzer@rz.tu-ilmenau.de","Really great");
3 : if Req("Do you want to quit FlushCX ??","Yho|No way")=1 then
ex:=true;
4 : ;
otherwise
end;
end;
until ex;
err:=RemoveAppMenuItem(CItem);
end;
DeleteMsgPort(CPort);
end;
CloseLibrary(WorkbenchBase);
end;
end;
end.